home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™94 / Hacks / [√] May be freely distributed / Keith Stattenfield / MacsbugWindow ƒ / main.cp < prev   
Encoding:
Text File  |  1994-06-25  |  1.2 KB  |  65 lines  |  [TEXT/KAHL]

  1. #include <Events.h>
  2.  
  3.  
  4. void InitToolbox(void);
  5.  
  6. void InitToolbox()
  7. {
  8.     InitGraf((Ptr) &qd.thePort);
  9.     InitFonts();
  10.     InitWindows();
  11.     InitMenus();
  12.     FlushEvents(everyEvent,0);
  13.     TEInit();
  14.     InitDialogs(0L);
  15.     InitCursor();
  16. }
  17. #if 0
  18. main()
  19. {
  20.     InitToolbox();
  21.  
  22.     Rect bounds = { 40, 8, 40 + 480, 8 + 640 };
  23.     WindowPtr macsbugWindowP = NewWindow ( nil, & bounds, "\pMacsbug", true, 0, (WindowPtr) nil, true, 0 );
  24.  
  25.     BitMap macsbugDisplayBitMap;
  26.     
  27.     Rect r = { 0, 0, 480, 640 };
  28.     macsbugDisplayBitMap.baseAddr = (Ptr) 0x17cac62;
  29.     macsbugDisplayBitMap.rowBytes = 640 / 8;
  30.     macsbugDisplayBitMap.bounds = r;
  31.     
  32.     Boolean gQuit = false;
  33.     
  34.     while ( gQuit == false )
  35.     {    EventRecord event;
  36.     
  37.         if ( WaitNextEvent ( everyEvent, & event, 60, nil ) )
  38.         {
  39.             switch ( event.what )
  40.             {
  41.                 case mouseDown:
  42.                 
  43.                     
  44.                 case updateEvt:
  45.                 {    WindowPtr window = (WindowPtr) event.message;
  46.                 
  47.                     if ( window == macsbugWindowP )
  48.                     {
  49.                         CopyBits ( & macsbugDisplayBitMap, & window->portBits,
  50.                                     & macsbugDisplayBitMap.bounds, & macsbugDisplayBitMap.bounds,
  51.                                     srcCopy, nil );
  52.                     }
  53.                 }
  54.                 break;
  55.             
  56.                 case keyDown:
  57.                     gQuit = true;
  58.                     break;
  59.             }
  60.         }
  61.     }
  62.                     
  63.     return 0;
  64. }
  65. #endif